﻿<!-- 成绩输入 -->
<style>
    .default-tab .el-table__body tr.current-row > td {
        background: #ceefbd !important;
    }

    .el-table .warning-row {
        background: oldlace;
    }

    .el-table .success-row {
        background: #b6ff00;
    }

    .el-table .suc {
        background-color: #f0f9eb;
        color: #67c23a;
    }

    .qjtable .el-input-group__prepend {
        border-right: 0;
        padding: 0px 10px;
    }

    .qjtable .el-input__inner {
        padding: 0px 5px;
    }
</style>
<template>

    <div>

        <!-- 添加按钮 -->
        <!-- 按条件选择 -->
        <!--<div class="tab-filter-type" style="margin-left: 20PX;">

            <div class="oh mt20">
                <p class="">学期：{{xq}}</p>
                <p class="">课程：{{kcmc}}</p>
                <p class="">班级：{{kcmc}}</p>

            </div>
        </div>-->
        <div style="margin: 15px 0 0 10PX" class="row">

            <div class="col-xs-7">
                <table class="table table-bordered table-condensed qjtable" style="font-size: 13px;">
                    <tr>
                        <td class="text-right"><strong> 课程：</strong></td>
                        <td class="text-left" colspan="3"><strong v-text="kcmc"></strong></td>

                    </tr>
                    <tr>
                        <td style="width:90px;text-align:right"><strong> 学期：</strong></td>
                        <td class="text-left"><strong v-text="xq"></strong></td>
                        <td class="text-right"><strong> 班级：</strong></td>
                        <td class="text-left"><strong v-text="bj"></strong></td>

                    </tr>


                    <tr>
                        <td class="text-right">
                            <strong> 分值占比：</strong>
                        </td>
                        <td colspan="3">
                            <div class="col-xs-4">
                                <el-input placeholder="占比" v-model="bl1" type="number" size="mini" style="width:140PX">
                                    <template slot="prepend">
                                        平时占比%
                                    </template>


                                </el-input>
                            </div>
                            <div class="col-xs-4">
                                <el-input placeholder="占比" v-model="bl2" type="number" size="mini" style="width:140PX">
                                    <template slot="prepend">
                                        过程占比%
                                    </template>


                                </el-input>
                            </div>

                            <div class="col-xs-4">
                                <el-input placeholder="占比" v-model="bl3" type="number" :disabled="true" size="mini" style="width:140PX">
                                    <template slot="prepend">
                                        期末占比%
                                    </template>
                                </el-input>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td class="text-right">
                            <strong> 成绩统计：</strong>
                        </td>
                        <td class="text-danger" colspan="3">
                            <button class="btn btn-primary ml5 mt10 btn-xs" type="button" v-for="item in tjdata">
                                {{item.sx}} <span class="badge" v-text="item.sl"></span>
                            </button>
                            <button class="btn btn-primary ml5 mt10 btn-xs" type="button" v-for="item in tjlbdata" v-show="item.sl!='0'">
                                {{item.sx}} <span class="badge" v-text="item.sl"></span>
                            </button>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="col-xs-5">
                <table class="table table-bordered table-condensed" style="    font-size: 13px;">
                    <tr>
                        <td class="text-center">
                            <strong> 成绩输入说明</strong>
                        </td>
                    </tr>
                    <tr>
                        <td class="text-danger">
                            1：修改占比值后会重新计算所有成绩,所以请先确定占比值后再输入成绩<BR />
                            2："总评成绩"中可以输入分数，也可选择以下信息输入缺考,退学,作弊,零分卷,缓考,无资格<BR />
                            3：导入成绩时先导出数据，然后完善成绩后另存为xlsx格式后再导入，否则无法导入,导入后也可按比例重新计算总评成绩<BR />
                            4：在成绩正式提交前可通过点击“成绩保存”按钮多次修改成绩<BR />
                            5：一旦点击“成绩提交”按钮并成功提交后，不能再修改成绩，请谨慎点击<BR />
                            6：补考类型只能填"正常补考","非正常补考"或空,否则无法进行成绩提交操作<BR />
                            7：正常补考：总评不及格的。非正常补考：旷考；考试舞弊计零分者；到课率不足2/3；单独开设的实验、设计、实习等实践课程和毕业实习、毕业论文（设计）等实践性教学环节，考核不及格的。
                        </td>
                    </tr>

                </table>
            </div>
        </div>
        <div class="row ml15 mr15 hidden">
            <div class="col-xs-6 text-center">
                <button type="button" class="btn btn-warning btn-sm  mr20" @click="daoru() "><i class="iconfont icon-dr ft12 mr5"></i>成绩导入</button>
                <input type="file" name="upFile" id="upFile" class="form-control" @change="LoadUser()" accept=".xls,.xlsx" style="display:none;">
            </div>
            <div class="col-xs-6 text-center">
                <button type="button" class="btn btn-info btn-sm mr20" @click="baocun()" v-show="iscansr=='Y'"><i class="iconfont icon-jiahao ft12 mr5"></i>成绩保存</button>
                <button type="button" class="btn btn-success btn-sm" @click="tijiao()" v-show="iscansr=='Y'"><i class="iconfont icon-chenggong ft12 mr5"></i>成绩提交</button>
            </div>





        </div>
        <div class="default-tab ft14  hover-btn" style="overflow-x: inherit;padding:20PX;padding-top:10px">
            <div style="width:100%;height:40px; padding-left:10px; line-height:40px; border: 1px solid #EBEEF5;border-bottom: 0px;">
                <div class="col-xs-4 text-left">
                    <p class="text-info text-center" style="font-weight:bolder">{{tstitle}}</p>

                </div>
                <div class="col-xs-8 text-right">
                    <button type="button" class="btn btn-warning btn-sm  mr20 mt5 pull-left" @click="exportxls() "><i class="iconfont icon-dr ft12 mr5"></i>成绩导出</button>
                    <button type="button" class="btn btn-warning btn-sm  mr20 mt5 pull-left" @click="daoru() "><i class="iconfont icon-dr ft12 mr5"></i>成绩导入</button>
                    <input type="file" name="upFile" id="upFile" class="form-control" @change="LoadUser()" accept=".xls,.xlsx" style="display:none;">

                    <button type="button" class="btn btn-info btn-sm mr20" @click="cxjs()" v-show="iscansr=='Y'">按比例重新计算总评成绩</button>
                    <button type="button" class="btn btn-info btn-sm mr20" @click="baocun()" v-show="iscansr=='Y'"><i class="iconfont icon-jiahao ft12 mr5"></i>成绩保存</button>
                    <button type="button" class="btn btn-success btn-sm" @click="tijiao()" v-show="iscansr=='Y'"><i class="iconfont icon-chenggong ft12 mr5"></i>成绩提交</button>

                </div>
            </div>
            <el-table v-loading="loading" :data="dataset.filter(data => !search || data.xm.toLowerCase().includes(search.toLowerCase()))" class="qjTable" height="450px" :row-style="{height:'20px'}" :cell-style="{padding:'0px'}" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)" @selection-change="handleSelectionChange" :row-class-name="tableRowClassName" stripe border fit use-virtual big-data-checkbox>

                <!--<el-table-column prop="qjdrzt" label="状态" width="80" sortable>
                    <template slot-scope="scope">
                        <i class="el-alert__icon el-icon-success" v-bind:class="{ suc: scope.row.qjdrzt=='Y' }"></i>
                    </template>
                </el-table-column>-->
                <el-table-column type="index" width="60" fixed="left"> </el-table-column>
                <!--<pl-table-column prop="bj"
                                 label="班级">
                </pl-table-column>-->
                <el-table-column prop="xh"
                                 label="学号">
                    <template slot-scope="scope">
                        <div style="padding:0px">

                            {{scope.row.xh}}
                            <!--<i class="el-alert__icon el-icon-success" v-bind:class="{ suc: scope.row.qjdrzt=='Y' }"></i>-->
                        </div>
                    </template>
                </el-table-column>
                <el-table-column prop="xklb"
                                 label="选课类别">
                </el-table-column>
                <el-table-column prop="xm" width="180">
                    <template slot="header" slot-scope="scope">
                        <div style="padding:0px">

                            姓名
                        </div>
                        <el-input v-model="search"
                                  size="mini"
                                  placeholder="搜索姓名" style="width:80PX;padding:0PX" />
                    </template>
                </el-table-column>

                <el-table-column prop="cpscj"
                                 label="平时成绩"
                                 width="140" sortable>

                    <template slot-scope="scope">
                        <el-input-number v-model="scope.row.cpscj" style="width:90px" size="mini" controls-position="right" :precision="1" :step="1" :min="0" :max="100" @change="currentValue=>pschange(currentValue,scope.row)"></el-input-number>
                    </template>
                </el-table-column>
                <el-table-column prop="cqzcj"
                                 label="过程考核成绩"
                                 width="140" sortable>
                    <template slot-scope="scope">
                        <el-input-number v-model="scope.row.cqzcj" style="width:90px" size="mini" controls-position="right" :precision="1" :step="1" :min="0" :max="100" @change="currentValue=>qzchange(currentValue,scope.row)"></el-input-number>
                    </template>
                </el-table-column>
                <el-table-column prop="cqmcj"
                                 label="期末成绩"
                                 width="140" sortable>

                    <template slot-scope="scope">
                        <el-input-number v-model="scope.row.cqmcj" style="width:90px" size="mini" controls-position="right" :precision="1" :step="1" :min="0" :max="100" @change="currentValue=>qmchange(currentValue,scope.row)"></el-input-number>
                    </template>
                </el-table-column>
                <el-table-column prop="kscj"
                                 label="总评成绩"
                                 width="140" sortable>

                    <template slot-scope="scope">
                        <el-input v-model="scope.row.kscj" size="mini" style="width:90px"></el-input>
                        <!--<el-autocomplete class="inline-input" size="mini" v-model="scope.row.kscj" :fetch-suggestions="querySearch" @change="currentValue=>zpchange(currentValue,scope.row)"></el-autocomplete>-->
                        <el-dropdown @command="command=>handleCommand(command,scope.row)">
                            <span class="el-dropdown-link">
                                <i class="el-icon-arrow-down el-icon--right"></i>
                            </span>
                            <el-dropdown-menu slot="dropdown">
                                <el-dropdown-item command="缺考">缺考</el-dropdown-item>
                                <el-dropdown-item command="退学">退学</el-dropdown-item>
                                <el-dropdown-item command="作弊">作弊</el-dropdown-item>
                                <el-dropdown-item command="零分卷">零分卷</el-dropdown-item>
                                <el-dropdown-item command="缓考">缓考</el-dropdown-item>
                                <el-dropdown-item command="无资格">无资格</el-dropdown-item>
                                <el-dropdown-item command="补及">补及</el-dropdown-item>
                                <el-dropdown-item command="补不及">补不及</el-dropdown-item>
                            </el-dropdown-menu>
                        </el-dropdown>
                    </template>
                </el-table-column>
                <el-table-column prop="bklb"
                                 label="补考类型"
                                 width="150" sortable>

                    <template slot-scope="scope">
                        <span>
                            {{scope.row.bklb | calbklx(scope.row.kscj)}}
                        </span>
                        <!--<el-autocomplete class="inline-input" size="mini" v-model="scope.row.bklb" :fetch-suggestions="querybk" clearable></el-autocomplete>-->
                    </template>
                </el-table-column>
                <!--<pl-table-column label="操作列" min-width="120" align="center" v-if="iscz&&pzoption.collist.length>6" fixed="left">
                    <template slot-scope="scope">
                        <el-button type="info" size="mini">二夫人</el-button>
                    </template>
                </pl-table-column>-->

            </el-table>
        </div>
        <!-- 表格 -->



    </div>
</template>

<script>
const { debug } = require("console");

    module.exports = {
        props: ['pdata'],
        components: {
            'base-table': httpVueLoader('/ViewV5/Base/Vue/Table.vue')
        },
        data: function () {
            return {
                tstitle: "",
                loading: true,
                bj: "",
                kclx: ComFunJS.getQueryString("kclx"),
                jsmc: "",
                xq: ComFunJS.getQueryString("xq"),
                bh: ComFunJS.getQueryString("bh"),
                kcdm: ComFunJS.getQueryString("kcdm"),
                kch: ComFunJS.getQueryString("kch"),
                ksxzm: ComFunJS.getQueryString("ksxzm"),
                kcmc: "",
                search: "",
                iscansr: "N",
                bl1: 20,
                bl2: 20,
                bl3: 60,
                dataset: [],
                tjdata: [{ sx: "60分以下", sl: 0 }, { sx: "60-80分", sl: 0 }, { sx: "81-90分", sl: 0 }, { sx: "91-100分", sl: 0 }],
                tjlbdata: [{ sx: "缺考", sl: 0 }, { sx: "退学", sl: 0 }, { sx: "作弊", sl: 0 }, { sx: "零分卷", sl: 0 }, { sx: "缓考", sl: 0 }, { sx: "无资格", sl: 0 }, { sx: "补及", sl: 0 }, { sx: "补不及", sl: 0 }]


            }
        },
        filters: {
            calbklx: function (value, kscj) {
                var re = "";
                if (!isNaN(kscj)) {
                    if (kscj * 1 < 60) {
                        re = "正常补考";
                    }
                }
                if (kscj == "缺考" || kscj == "作弊" || kscj == "零分卷" || kscj == "无资格") {
                    re = "非正常补考";
                }
                if (kscj == "缓考") {
                    re = "正常补考";
                }
                if (_.trim(kscj)=="") {
                    re = "";
                }
                return re;
            }
        },
        methods: {
            cubklb: function (kscj) {
                var re = "";
                if (!isNaN(kscj)) {
                    if (kscj * 1 < 60) {
                        re = "正常补考";
                    }
                }
                if (kscj == "缺考" || kscj == "作弊" || kscj == "零分卷" || kscj == "无资格") {
                    re = "非正常补考";
                }
                if (kscj == "缓考") {
                    re = "正常补考";
                }
                if (_.trim(kscj) == "") {
                    re = "";
                }
                return re;
            },
            getQueryString: function (name, defauval) {//获取URL参数,如果获取不到，返回默认值，如果没有默认值，返回空格
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
                var r = window.location.search.substr(1).match(reg);
                if (r != null) { return unescape(decodeURI(r[2])); }
                else {
                    return defauval || "";
                }
            },//获取参数
            isnum: function (value) {
                return typeof value === 'number' && !isNaN(value);
            },
            tableRowClassName({ row, rowIndex }) {
                row.index = rowIndex;
                if (rowIndex === 1) {
                    return 'warning-row';
                } else if (rowIndex === 3) {
                    return 'success-row';
                }
                return '';
            },
            handleSelectionChange(val) {
                console.debug(val);
            },
            querySearch(queryString, cb) {
                var results = [{ value: "缺考" }, { value: "退学" }, { value: "作弊" }, { value: "零分卷" }, { value: "缓考" }, { value: "无资格" }, { value: "补及" }, { value: "补不及" }];
                // 调用 callback 返回建议列表的数据
                cb(results);
            },
            querybk(queryString, cb) {
                var results = [{ value: "正常补考" }, { value: "非正常补考" }];
                // 调用 callback 返回建议列表的数据
                cb(results);
            },
            pschange: function (val, row) {
                var pro = this;
                var pscj = row.cpscj;
                var qzcj = row.cqzcj;
                var qmcj = row.cqmcj;
                var zpcj = pscj * (pro.bl1 / 100) + qzcj * (pro.bl2 / 100) + qmcj * (pro.bl3 / 100);
                row.kscj = (Math.floor(zpcj * 100) / 100).toFixed(1) + "";
            },
            qzchange: function (val, row) {
                var pro = this;
                var pscj = row.cpscj;
                var qzcj = row.cqzcj;
                var qmcj = row.cqmcj;
                var zpcj = pscj * (pro.bl1 / 100) + qzcj * (pro.bl2 / 100) + qmcj * (pro.bl3 / 100);
                row.kscj = (Math.floor(zpcj * 100) / 100).toFixed(1) + "";
            },
            qmchange: function (val, row) {
                var pro = this;
                var pscj = row.cpscj;
                var qzcj = row.cqzcj;
                var qmcj = row.cqmcj;
                var zpcj = pscj * (pro.bl1 / 100) + qzcj * (pro.bl2 / 100) + qmcj * (pro.bl3 / 100);
                row.kscj = (Math.floor(zpcj * 100) / 100).toFixed(1) + "";
            },
            cxjs: function () {
                var pro = this;
                _.forEach(pro.dataset, function (row) {
                    if (row.kscj != "缺考" && row.kscj != "退学" && row.kscj != "作弊" && row.kscj != "零分卷" && row.kscj != "缓考" && row.kscj != "无资格" && row.kscj != "补及" && row.kscj != "补不及") {
                        var pscj = row.cpscj;
                        var qzcj = row.cqzcj;
                        var qmcj = row.cqmcj;
                        var zpcj = pscj * (pro.bl1 / 100) + qzcj * (pro.bl2 / 100) + qmcj * (pro.bl3 / 100);
                        row.kscj = (Math.floor(zpcj * 100) / 100).toFixed(1) + "";
                    }

                })

            },
            tinum: function (val) {

                if (!this.isnum(val * 1)) {
                    return 0;
                } else {
                    return val * 1;
                }
            },
            zpchange: function (val, row) {
                var pro = this;

                //row.kscj =  "";
            },
            handleCommand(val, row) {
                row.kscj = val;
                this.zpchange(val, row);
            },
            exportxls: function () {
                var title = [];
                title.push({ "value": "学号", "type": "ROW_HEADER_HEADER", "datatype": "string", "colid": "xh" });
                title.push({ "value": "姓名", "type": "ROW_HEADER_HEADER", "datatype": "string", "colid": "xm" });
                title.push({ "value": "平时成绩", "type": "ROW_HEADER_HEADER", "datatype": "string", "colid": "cpscj" });
                title.push({ "value": "过程考核成绩", "type": "ROW_HEADER_HEADER", "datatype": "string", "colid": "cqzcj" });
                title.push({ "value": "期末成绩", "type": "ROW_HEADER_HEADER", "datatype": "string", "colid": "cqmcj" });
                title.push({ "value": "总评成绩", "type": "ROW_HEADER_HEADER", "datatype": "string", "colid": "kscj" });
                //title.push({ "value": "补考类型", "type": "ROW_HEADER_HEADER", "datatype": "string", "colid": "bklb" });

                this.JSONToExcelConvertor(this.dataset, "成绩导入列表" + ComFunJS.getnowdate('yyyy-mm-dd'), title);
            },
            JSONToExcelConvertor: function (JSONData, FileName, ShowLabel) {

                var arrData = typeof JSONData != 'object' ? JSON.parse(JSONData) : JSONData;

                var excel = '<table>';
                //设置表头
                var row = "<tr>";
                for (var i = 0, l = ShowLabel.length; i < l; i++) {
                    //解决身份证问题
                    row += '<td style="' + "mso-number-format:'\@';\"" + ">" + ShowLabel[i].value + '</td>';
                }

                //换行
                excel += row + "</tr>";

                //设置数据
                for (var i = 0; i < arrData.length; i++) {
                    var row = "<tr>";

                    for (var j = 0; j < ShowLabel.length; j++) {
                        //解决身份证问题
                        var value = arrData[i][ShowLabel[j].colid];
                        row += '<td style="' + "mso-number-format:'\@';\"" + ">\t" + value + "</td>";
                    }

                    excel += row + "</tr>";
                }

                excel += "</table>";

                var excelFile = "<html xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:x='urn:schemas-microsoft-com:office:excel' xmlns='http://www.w3.org/TR/REC-html40'>";
                excelFile += '<meta http-equiv="content-type" content="application/vnd.ms-excel; charset=UTF-8">';
                excelFile += '<meta http-equiv="content-type" content="application/vnd.ms-excel';
                excelFile += '; charset=UTF-8">';
                excelFile += "<head>";
                excelFile += "<!--[if gte mso 9]>";
                excelFile += "<xml>";
                excelFile += "<x:ExcelWorkbook>";
                excelFile += "<x:ExcelWorksheets>";
                excelFile += "<x:ExcelWorksheet>";
                excelFile += "<x:Name>";
                excelFile += "{worksheet}";
                excelFile += "</x:Name>";
                excelFile += "<x:WorksheetOptions>";
                excelFile += "<x:DisplayGridlines/>";
                excelFile += "</x:WorksheetOptions>";
                excelFile += "</x:ExcelWorksheet>";
                excelFile += "</x:ExcelWorksheets>";
                excelFile += "</x:ExcelWorkbook>";
                excelFile += "</xml>";
                excelFile += "<![endif]-->";
                excelFile += "</head>";
                excelFile += "<body>";
                excelFile += excel;
                excelFile += "</body>";
                excelFile += "</html>";


                var uri = 'data:application/vnd.ms-excel;charset=utf-8,' + encodeURIComponent(excelFile);

                var link = document.createElement("a");
                link.href = uri;

                link.style = "visibility:hidden";
                link.download = FileName + ".xls";

                document.body.appendChild(link);
                link.click();
                document.body.removeChild(link);
            },
            InitWigetData: function () {
                var pro = this;
                pro.kclx = pro.getQueryString("kclx");
                pro.jsmc = pro.getQueryString("jsmc");
                $.getJSON('/API/VIEWAPI.ashx?Action=CJGL_GETCJDATA', { kclx: pro.kclx, jsmc: pro.jsmc, xq: pro.xq, bh: pro.bh, kcdm: pro.kcdm, kch: pro.kch, ksxzm: pro.ksxzm }, function (resultData) {
                    if (resultData.Result.length > 0) {
                        pro.dataset = resultData.Result;
                        pro.kcmc = resultData.Result[0].kcmc;
                        pro.xq = resultData.Result[0].xq;
                        pro.bj = resultData.Result[0].bj;
                        pro.iscansr = resultData.Result1;
                        if (resultData.Result[0].psbl) {
                            pro.bl1 = resultData.Result[0].psbl;
                            pro.bl2 = resultData.Result[0].qzbl;
                            pro.bl3 = resultData.Result[0].qmbl;
                        }

                        pro.loading = false;

                    }
                })

            },
            baocun: function () {

                this.savedata("41");

            },
            tijiao: function () {
                var pro = this;
                _.forEach(pro.dataset, function (obj) {
                    if (obj.bklb != "非正常补考" && obj.bklb != "正常补考" && _.trim(obj.bklb) != "") {
                        alert("补考类别填写错误..请仔细阅读填写说明!!");
                        return;
                    }
                })
                this.$confirm('提交成绩后不可修改, 是否确认要提交成绩?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    this.savedata("42");
                }).catch(() => {
                    this.$message({
                        type: 'info',
                        message: '已取消提交'
                    });
                });
            },
            daoru: function () {
                $("#upFile").trigger("click");

            },
            LoadUser: function () {
                var pro = this;
                pro.loading = true;
                if (document.getElementById("upFile").files.length > 0) {
                    var formData = new FormData();
                    formData.append("upFile", document.getElementById("upFile").files[0]);
                    formData.append("headrow", "0");
                    $.ajax({
                        url: "/API/VIEWAPI.ashx?Action=UPEXCEL",
                        type: "POST",
                        data: formData,
                        /**
                        *必须false才会自动加上正确的Content-Type
                        */
                        contentType: false,
                        /**
                        * 必须false才会避开jQuery对 formdata 的默认处理
                        * XMLHttpRequest会对 formdata 进行正确的处理
                        */
                        processData: false,
                        success: function (result) {
                            var r = $.parseJSON(result);
                            var tempdata = JSON.parse(JSON.stringify(pro.dataset));
                            _.forEach(tempdata, function (cj) {
                                var cjitem = _.find(r.Result, function (obj) {
                                    return cj.xh == obj.学号
                                })
                                if (cjitem) {
                                    if (cj.cpscj != cjitem.平时成绩) {
                                        cj.cpscj = cjitem.平时成绩;
                                    }
                                    if (cj.cqzcj != cjitem.过程考核成绩) {
                                        cj.cqzcj = cjitem.过程考核成绩;
                                    }
                                    if (cj.cqmcj != cjitem.期末成绩) {
                                        cj.cqmcj = cjitem.期末成绩;
                                    }
                                    if (cj.kscj != cjitem.总评成绩) {
                                        cj.kscj = cjitem.总评成绩;
                                    }
                                    //if (cj.bklb != cjitem.补考类型) {
                                    //    cj.bklb = cjitem.补考类型;
                                    //}
                                }

                            })
                            pro.dataset = tempdata;
                            pro.loading = false;
                            alert('导入完毕')


                        }
                    });
                }
                else {
                    ComFunJS.winwarning("请上传文件");
                }
            },
            savedata: function (bczt) {
                var pro = this;
                pro.loading = true;
                //pro.cxjs();
                _.forEach(pro.dataset, function (obj) {
                    try {
                        obj.bklb = pro.cubklb(obj.kscj);
                    } catch (e) {

                    }
                })
                $.getJSON('/API/VIEWAPI.ashx?Action=CJGL_SAVECJDATA', { P1: JSON.stringify(pro.dataset), P2: bczt, cjbl: pro.bl1 + "," + pro.bl2 + "," + pro.bl3, kclx: pro.kclx, jsmc: pro.jsmc, xq: pro.xq, bh: pro.bh, kcdm: pro.kcdm, kch: pro.kch, ksxzm: pro.ksxzm }, function (resultData) {
                    if (resultData.Result.length > 0) {
                        pro.loading = false;
                        pro.tstitle = resultData.Result1;
                        pro.$notify({
                            title: '成功',
                            message: '操作成功',
                            type: 'success'
                        });
                        pro.dataset = resultData.Result;

                    }
                })
            }
        },
        mounted: function () {
            var pro = this;
            pro.$nextTick(function () {
                pro.InitWigetData();
            })

        },
        watch: {

            bl1: { //深度监听，可监听到对象、数组的变化
                handler(newV, oldV) {
                    this.bl3 = 100 - (this.bl1 * 1 + this.bl2 * 1);
                    this.cxjs();
                },
                deep: true
            },
            bl2: { //深度监听，可监听到对象、数组的变化
                handler(newV, oldV) {
                    this.bl3 = 100 - (this.bl1 * 1 + this.bl2 * 1);
                    this.cxjs();

                },
                deep: true
            },
            dataset: {
                handler(newValue, oldValue) { // oldValue是activeArticle变化之前的值，newValue是activeArticle变化之后的值
                    console.debug("count");
                    var pro = this;
                    _.forEach(pro.tjdata, function (tj) {
                        switch (tj.sx) {
                            case "60分以下":    //等于
                                {
                                    var cou = 0;
                                    _.forEach(pro.dataset, function (cj) {
                                        if (pro.tinum(cj.kscj) >= 0 && pro.tinum(cj.kscj) <= 59) {
                                            cou++;
                                        }
                                    })
                                    tj.sl = cou;
                                }
                                break;
                            case "60-80分":    //小于
                                {
                                    var cou = 0;
                                    _.forEach(pro.dataset, function (cj) {
                                        if (pro.tinum(cj.kscj) >= 60 && pro.tinum(cj.kscj) <= 80) {
                                            cou++;
                                        }
                                    })
                                    tj.sl = cou;
                                }
                                break;
                            case "81-90分":    //大于
                                {
                                    var cou = 0;
                                    _.forEach(pro.dataset, function (cj) {
                                        if (pro.tinum(cj.kscj) >= 81 && pro.tinum(cj.kscj) <= 90) {
                                            cou++;
                                        }
                                    })
                                    tj.sl = cou;
                                }
                                break;
                            case "91-100分":    //小于
                                {
                                    var cou = 0;
                                    _.forEach(pro.dataset, function (cj) {
                                        if (pro.tinum(cj.kscj) >= 91 && pro.tinum(cj.kscj) <= 100) {
                                            cou++;
                                        }
                                    })
                                    tj.sl = cou;

                                }
                                break;
                            default: {

                            }
                        }
                    })
                    _.forEach(pro.tjlbdata, function (tj) {
                        var cou = 0;
                        _.forEach(pro.dataset, function (cj) {
                            if (cj.kscj == tj.sx) {
                                cou++;
                            }
                        })
                        tj.sl = cou;

                    })
                },
                deep: true
            }

        }
    };
</script>